#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int Gcd(int a, int b)
{
    if (a <= 0 || b <= 0)
        return -1;
    int x = a < b ? a : b;
    while (x > 0)
    {
        if (a % x == 0 && b % x == 0)
            return x;
        x--;
    }
}

int main()
{
    int a, b, c;
    scanf("%d %d", &a, &b);
    c = Gcd(a, b);
    if (c != -1)
    {
        printf("%d\n", c);
    }
    else
    {
        printf("Input Data error!\n");
    }
    return 0;
}
